﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>云科技</title>

    <link type="text/css" rel="stylesheet" media="all" href="../styles/global.css"/>
    <link type="text/css" rel="stylesheet" media="all" href="../styles/global_color.css"/>
    <script src="../js/jquery-2.2.4.min.js"></script>
    <script language="javascript" type="text/javascript">
        //保存成功的提示信息
        function showResult() {
            showResultDiv(true);
            window.setTimeout("showResultDiv(false);", 3000);
        }

        function showResultDiv(flag) {
            var divResult = document.getElementById("save_result_info");
            if (flag)
                divResult.style.display = "block";
            else
                divResult.style.display = "none";
        }

        //显示修改密码的信息项
        function showPwd(chkObj) {
            if (chkObj.checked)
                document.getElementById("divPwds").style.display = "block";
            else
                document.getElementById("divPwds").style.display = "none";
        }
    </script>
    <script src="../js/module.js"></script>
</head>
<body>
<!--Logo区域开始-->
<div id="header">
    <img src="../images/logo.png" alt="logo" class="left"/>
    <a href="#">[退出]</a>
</div>
<!--Logo区域结束-->
<!--导航区域开始-->
<div id="navi">
    <ul id="menu">
        <li><a href="../index.html" class="index_off"></a></li>
        <li><a href="../user/user_info.html" class="information_off"></a></li>
        <li><a href="../user/user_modi_pwd.html" class="password_off"></a></li>
    </ul>
</div>

<!--导航区域结束-->
<!--主要区域开始-->
<div id="main">
    <!--保存成功或者失败的提示消息-->
    <div id="save_result_info" class="save_fail">保存失败，旧密码错误！</div>
    <form action="../account/account_list.html" method="post" class="main_form">
        <!--必填项-->
        <div class="text_info clearfix"><span>账务账号ID：</span></div>
        <div class="input_info">
            <input id="accountId" type="text" readonly class="readonly"/>
        </div>
        <div class="text_info clearfix"><span>姓名：</span></div>
        <div class="input_info">
            <input id="realName" type="text"/>
            <span class="required">*</span>
            <div class="validate_msg_long error_msg">20长度以内的汉字、字母和数字的组合</div>
        </div>
        <div class="text_info clearfix"><span>身份证：</span></div>
        <div class="input_info">
            <input id="idCard" type="text" readonly class="readonly"/>
        </div>
        <div class="text_info clearfix"><span>登录账号：</span></div>
        <div class="input_info">
            <input id="loginName" type="text" readonly class="readonly"/>

            <div class="change_pwd">
                <input id="chkModiPwd" type="checkbox" onclick="showPwd(this);"/>
                <label for="chkModiPwd">修改密码</label>
            </div>

        </div>
        <!--修改密码部分-->
        <div id="divPwds">
            <div class="text_info clearfix"><span>旧密码：</span></div>
            <div class="input_info">
                <input id="pastPd" type="password"/>
                <span class="required">*</span>
                <div class="validate_msg_long">30长度以内的字母、数字和下划线的组合</div>
            </div>
            <div class="text_info clearfix"><span>新密码：</span></div>
            <div class="input_info">
                <input id="newPd" type="password"/>
                <span class="required">*</span>
                <div class="validate_msg_long">30长度以内的字母、数字和下划线的组合</div>
            </div>
            <div class="text_info clearfix"><span>重复新密码：</span></div>
            <div class="input_info">
                <input id="repeatPd" type="password"/>
                <span class="required">*</span>
                <div class="validate_msg_long">两次密码必须相同</div>
            </div>
        </div>

        <div class="text_info clearfix"><span>电话：</span></div>
        <div class="input_info">
            <input id="telephone" type="text" class="width200"/>
            <span class="required">*</span>
            <div class="validate_msg_medium error_msg">正确的电话号码格式：手机或固话</div>
        </div>
        <div class="text_info clearfix"><span>推荐人身份证号码：</span></div>
        <div class="input_info">
            <input type="text" value="211223199610163819"/>
            <div class="validate_msg_long error_msgs">正确的身份证号码格式</div>
        </div>
        <div class="text_info clearfix"><span>生日：</span></div>
        <div class="input_info">
            <input id="birth" type="text" value="由身份证号计算而来" readonly class="readonly"/>
        </div>
        <div class="text_info clearfix"><span>Email：</span></div>
        <div class="input_info">
            <input id="email" type="text" class="width200"/>
            <div class="validate_msg_medium">50长度以内，合法的 Email 格式</div>
        </div>
        <div class="text_info clearfix"><span>职业：</span></div>
        <div class="input_info">
            <select id="occupation">
                <option>干部</option>
                <option>学生</option>
                <option>技术人员</option>
                <option>其他</option>
            </select>
        </div>
        <div class="text_info clearfix"><span>性别：</span></div>

        <div id="gender" class="input_info fee_type">
            <input type="radio" name="radSex" value="女" id="female"/>
            <label for="female">女</label>

            <input type="radio" name="radSex" value="男"  id="male"/>
            <label for="male">男</label>
        </div>
        <div class="text_info clearfix"><span>通信地址：</span></div>
        <div class="input_info">
            <input id="mailAddress" type="text" class="width350"/>
            <div class="validate_msg_tiny">50长度以内</div>
        </div>
        <div class="text_info clearfix"><span>邮编：</span></div>
        <div class="input_info">
            <input id="zipcode" type="text"/>
            <div class="validate_msg_long">6位数字</div>
        </div>
        <div class="text_info clearfix"><span>QQ：</span></div>
        <div class="input_info">
            <input id="qq" type="text"/>
            <div class="validate_msg_long">5到13位数字</div>
        </div>
        <!--操作按钮-->
        <div class="button_info clearfix">
            <input id="save" type="button" value="保存" class="btn_save"/>
            <input type="button" value="取消" class="btn_save" onclick="location.href='account_modi.html'"/>
        </div>
    </form>

    <script>


        $(function () {
            //  根据网址取到ID
            var arr = window.location.search.split('=');
            var a = arr[1];
            var params = {
                accountId: a
            };
            $.post("/kobe/account/findById", params, function (resp) {

                $("#accountId").val(resp.accountId);
                $("#realName").val(resp.realName);
                $("#idCard").val(resp.idcardNo);
                $("#loginName").val(resp.loginName);
                // $("#pastPd").val(resp.loginPasswd);
                $("#telephone").val(resp.telephone);
                $("#birth").val(resp.birth);
                $("#email").val(resp.email);
                $("#occupation").val(resp.occupation);

                $("#gender").val(resp.gender);
                $("#mailAddress").val(resp.mailAddress);
                $("#zipcode").val(resp.zipcode);
                $("#qq").val(resp.qq);
            })

        });
        <!--保存按钮点击事件-->
        $("#save").click(function (e) {
            e.preventDefault();
            var accountId = $("#accountId").val();
            var realName = $("#realName").val();
            var idCard = $("#idCard").val();
            var loginName = $("#loginName").val();
            var newPd = $("#newPd").val();
            var telephone = $("#telephone").val();
            var birth = $("#birth").val();
            var email = $("#email").val();
            var occupation = $("#occupation").val();
            console.log(occupation);


            // var value = $('#gender').val();
            var value = $("input[type='radio']:checked").val();

            console.log(value);

            var mailAddress = $("#mailAddress").val();
            var zipcode = $("#zipcode").val();
            var qq = $("#qq").val();
            var url = "/kobe/account/update";
            var data = {
                "accountId": accountId,
                "realName": realName,
                "idcardNo": idCard,
                "loginName": loginName,
                "loginPasswd": newPd,
                "telephone": telephone,
                "birth": birth,
                "email": email,
                "occupation": occupation,
                "gender": value,
                "mailaddress": mailAddress,
                "zipcode": zipcode,
                "qq": qq
            };
            console.log(qq);
            $.post(url, data, function (resp) {
                location.href = "account_list.html";
                console.log(resp);
            })
        });


    </script>

</div>
<!--主要区域结束-->
<div id="footer">
    <span>[源自北美的技术，最优秀的师资，最真实的企业环境，最适用的实战项目]</span>
    <br/>
    <span>版权所有(C)云科技有限公司 </span>
</div>
</body>
</html>
